Skip to content

Conversation

@yedpodtrzitko
Copy link

@yedpodtrzitko yedpodtrzitko commented Jun 21, 2023

Building .snap package

a few notes for if (when) someone will be digging into this:

  • Snapcraft (tool for build snap packages) currently does not work on Apple Silicon due to a bug

  • Snapcraft uses lxd for building packages, which currently contains a bug preventing network connections when running in Qemu (ie. UTM).

    • there is another build system (multipass) but it also uses lxd, so using that instead does not change anything
  • the build can be performed directly on the machine instead of in another layer of virtualization with the following env. variable SNAPCRAFT_BUILD_ENVIRONMENT=host

    • Snapcraft however tries to run apt-get update for some reason, which does not work under normal user, so the most straightforward way how to avoid this error is to run the build under root (or use sticky bit maybe? idk, I'm running in VM anyway).
  • Snapcraft tries to determine version via git describe which looks up only "annotated tags" (which we dont do apparently), so there's added a fallback to determine the version via setuptools_scm (python setup.py --version)

  • current pyproject.toml is not fully functional, so I'm moving it out of the way to avoid Snapcraft trying to use it instead of setup.py

  • despite of that there are some changes in pyproject.toml I stumbled upon during this task. We'll eventually need these changes anwyay when migrating away from setup.py. These changes are analogy of the following part in setup.py:

setup_requires=['setuptools_scm'],
use_scm_version=True,
  • there is a bug (feature?) in Snapcraft which does not register site-packages inside the .snap, so it has to be manually appended into PYTHONPATH in the build file

  • there is another bug in Snapcraft which doesnt install b2.egg-info and/or b2.dist-info into the .snap. I'm not sure about the precise circumstances, but it was happening when I defined stage-packages in the snapcraft.yaml. The snap package is created and can be installed, but when run it ends up with exception (PackageNotFoundError: No package metadata was found for b2). Didnt dig into it too deep, as the current configuration works.

  • for uploading to B2 it uses the same env. variables / secrets as ci: add debianize build pipeline #176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants